package com.sjgtw.cloud.web.drillPlan.controller;

import java.util.List;
import java.util.Map;

import com.sjgtw.cloud.common.core.web.controller.BaseController;
import com.sjgtw.cloud.common.core.web.domain.AjaxResult;
import com.sjgtw.cloud.common.core.web.page.TableDataInfo;
import com.sjgtw.cloud.web.drillPlan.domain.DrillPlan;
import com.sjgtw.cloud.web.drillPlan.service.IDrillPlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 应急演练管理Controller
 * 
 * @author ruoyi
 * @date 2024-03-16
 */
@RestController
@Api(tags="1.14、应急演练管理")
@RequestMapping("/drillPlan")
public class DrillPlanController extends BaseController
{
    @Autowired
    private IDrillPlanService drillPlanService;

    /**
     * 查询应急演练管理列表
     */

    @GetMapping("/list")
    @ApiOperation("列表")
    public TableDataInfo list(DrillPlan drillPlan)
    {
        startPage();
        List<Map<String,Object>> list = drillPlanService.selectDrillPlanList(drillPlan);
        return getDataTable(list);
    }

    /**
     * 导出应急演练管理列表
     */
  /* @PostMapping("/export")
    public void export(HttpServletResponse response, DrillPlan drillPlan)
    {
        List<DrillPlan> list = drillPlanService.selectDrillPlanList(drillPlan);
        ExcelUtil<DrillPlan> util = new ExcelUtil<DrillPlan>(DrillPlan.class);
        util.exportExcel(response, list, "应急演练管理数据");
    }*/

    /**
     * 获取应急演练管理详细信息
     */
    @ApiOperation("获取详细信息")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(drillPlanService.selectDrillPlanById(id));
    }

    /**
     * 新增应急演练管理
     */
    @PostMapping("/add")
    @ApiOperation("新增")
    public AjaxResult add(@RequestBody DrillPlan drillPlan)
    {
        return toAjax(drillPlanService.insertDrillPlan(drillPlan));
    }

    /**
     * 修改应急演练管理
     */
    @PutMapping("/edit")
    @ApiOperation("修改")
    public AjaxResult edit(@RequestBody DrillPlan drillPlan)
    {
        return toAjax(drillPlanService.updateDrillPlan(drillPlan));
    }

    /**
     * 删除应急演练管理
     */
    @DeleteMapping("/delete/{id}")
    @ApiOperation("删除")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(drillPlanService.deleteDrillPlanById(id));
    }
}
